package schema

import (
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/edge"

	"entgo.io/ent"
	"entgo.io/ent/schema/field"
)

// Order schema.
type Order struct {
	ent.Schema
}

// Mixin of the order.
func (Order) Mixin() []ent.Mixin {
	return []ent.Mixin{
		ormMixin{},
	}
}

// Annotations of the order.
func (Order) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.Annotation{Table: "order"},
	}
}

// Fields of the order.
func (Order) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("user_id").Immutable(),
		field.Int64("merchant_id").Immutable(),
		field.Int32("price"),
		field.Int8("status"),
	}
}

// Edges of the order.
func (Order) Edges() []ent.Edge {
	return []ent.Edge{
		edge.To("items", OrderItem.Type),
	}
}
